import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ExtractAllWords {

	public static void main(String[] args) {
		String regex = "\\w+";
		String text = "Welcome to our Java course!";
		Pattern pattern = Pattern.compile(regex);
		Matcher matcher = pattern.matcher(text);
		while (matcher.find()) {
			int start = matcher.start();
			int end = matcher.end();
			String match = text.substring(start, end);
			System.out.println(match);
		}
	}
	
}
